﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <style type="text/CSS">
        .taskMenuItem {background-color: #C0C0C0; left: 20px; border: 2px solid #33CCFF; text-indent: 15px; height:20px; margin:1px; vertical-align:middle}
        .taskMenuItem:hover {background-color: #3366FF; cursor:pointer}
        .easyui-accordion ul{list-style-type:none;margin:0px; padding:10px;}
        .easyui-accordion ul li{ padding:0px; line-height:24px;}
        .easyui-accordion ul li div{margin:2px 0px;padding-left:10px;padding-top:2px;color:green}
        .easyui-accordion ul li div:hover{border:1px dashed #99BBE8; background:#E0ECFF;cursor:pointer;color:red}
        .easyui-accordion ul li div.selected{border:1px solid #99BBE8; background:#E0ECFF;cursor:default;}
        .easyui-accordion ul li div.selected a{color:#416AA3; font-weight:bold;}

    </style>
    <script type="text/javascript">
        var moduleMenuList = {
            "1001": "<Document>" +
                       "<Module>" +
                        "<ModuleName>学员管理</ModuleName>" +
                        "<ModuleIcon>Users2.png</ModuleIcon>" +
                        "<TaskList>" +
                          "<Task><TaskGuid>100101</TaskGuid><TaskName>学员列表</TaskName><TaskIcon>Users3.png</TaskIcon><TaskUrl>/Pages/Business/Student/StudentQuery.htm</TaskUrl></Task>" +
                          "<Task><TaskGuid>100102</TaskGuid><TaskName>学员信息</TaskName><TaskIcon>app_edit.png</TaskIcon><TaskUrl>/Pages/Business/Student/StudentInfo.htm</TaskUrl></Task>" +
                        "</TaskList>" +
                      "</Module>" +
                      "<Module>" +
                        "<ModuleName>教练管理</ModuleName>" +
                        "<ModuleIcon>Users.png</ModuleIcon>" +
                        "<TaskList>" +
                          "<Task><TaskGuid>100201</TaskGuid><TaskName>教练列表</TaskName><TaskIcon>Users3.png</TaskIcon><TaskUrl>/Pages/Business/Coach/CoachQuery.htm</TaskUrl></Task>" +
                          "<Task><TaskGuid>100202</TaskGuid><TaskName>教练排班</TaskName><TaskIcon>Holiday.png</TaskIcon><TaskUrl>/Pages/AssetMgt/FixedAsset/FixedAssetRegCheckList.htm</TaskUrl></Task>" +
                          "<Task><TaskGuid>100203</TaskGuid><TaskName>教练考核</TaskName><TaskIcon>Flag.png</TaskIcon><TaskUrl>/Pages/AssetMgt/FixedAsset/FixedAssetReviewList.htm</TaskUrl></Task>" +
                        "</TaskList>" +
                      "</Module>" +
                      "<Module>" +
                        "<ModuleName>车辆管理</ModuleName>" +
                        "<ModuleIcon>Car.png</ModuleIcon>" +
                        "<TaskList>" +
                              "<Task><TaskGuid>1003001</TaskGuid><TaskName>车辆信息</TaskName><TaskIcon></TaskIcon><TaskUrl>/Pages/Business/Vehicle/VehicleQuery.htm</TaskUrl></Task>" +
                        "</TaskList>" +
                      "</Module>" +
                      "<Module>" +
                        "<ModuleName>财务管理</ModuleName>" +
                        "<ModuleIcon>Finance.png</ModuleIcon>" +
                        "<TaskList>" +
                              "<Task><TaskGuid>1004001</TaskGuid><TaskName>学员缴款</TaskName><TaskIcon>MoneyStack.png</TaskIcon><TaskUrl>/Pages/AssetMgt/FixedAsset/ReportMgt/AssetTransfer/AssetTransList.htm</TaskUrl></Task>" +
                        "</TaskList>" +
                      "</Module>" +
                    "</Document>",
            "1002": "<Document>" +
                    "</Document>",
            "1003": "<Document>" +
                    "</Document>",
            "1004": "<Document>" +
                    "</Document>",
            "2001": "<Document>" +
                      "<Module>" +
                        "<ModuleName>字典设置</ModuleName>" +
                        "<ModuleIcon>Dictionary.png</ModuleIcon>" +
                        "<TaskList>" +
                          "<Task><TaskGuid>200101</TaskGuid><TaskName>证件类型</TaskName><TaskIcon>Identification.png</TaskIcon><TaskUrl>/Pages/System/Maintain/CodeListMaintenance.htm?category=证件类型&amp;type=value&amp;widths=300</TaskUrl></Task>" +
                          "<Task><TaskGuid>200102</TaskGuid><TaskName>人员性别</TaskName><TaskIcon>People.png</TaskIcon><TaskUrl>/Pages/System/Maintain/CodeListMaintenance.htm?category=性别&amp;type=code&amp;fixed=F,M</TaskUrl></Task>" +
                          "<Task><TaskGuid>200103</TaskGuid><TaskName>学员状态</TaskName><TaskIcon>UserStatus.png</TaskIcon><TaskUrl>/Pages/System/Maintain/CodeListMaintenance.htm?category=学员状态&amp;type=value</TaskUrl></Task>" +
                          "<Task><TaskGuid>200104</TaskGuid><TaskName>车辆状态</TaskName><TaskIcon>UserStatus.png</TaskIcon><TaskUrl>/Pages/System/Maintain/CodeListMaintenance.htm?category=车辆状态&amp;type=value</TaskUrl></Task>" +
                        "</TaskList>" +
                      "</Module>" +
                      "<Module>" +
                        "<ModuleName>组织机构设置</ModuleName>" +
                        "<ModuleIcon>Org.png</ModuleIcon>" +
                          "<Task><TaskGuid>200200</TaskGuid><TaskName>单位设置</TaskName><TaskIcon>Building.png</TaskIcon><TaskUrl>/Pages/SysMatain/SysOrg/Company/CompanyList.htm</TaskUrl></Task>" +
                          "<Task><TaskGuid>200201</TaskGuid><TaskName>部门设置</TaskName><TaskIcon>Org.png</TaskIcon><TaskUrl>/Pages/SysMatain/SysOrg/Department/DepartmentList.htm</TaskUrl></Task>" +
                          "<Task><TaskGuid>200202</TaskGuid><TaskName>人员设置</TaskName><TaskIcon>Users.png</TaskIcon><TaskUrl>/Pages/SysMatain/SysOrg/Member/MemberList.htm</TaskUrl></Task>" +
                          "<Task><TaskGuid>200203</TaskGuid><TaskName>权限设置</TaskName><TaskIcon>Certificate.png</TaskIcon><TaskUrl>/Pages/SysMatain/SysOrg/RoleAssignment.htm</TaskUrl></Task>" +
                          "<Task><TaskGuid>200204</TaskGuid><TaskName>群组设置</TaskName><TaskIcon>group.png</TaskIcon><TaskUrl>/Pages/SysMatain/SysOrg/Group/GroupList.htm</TaskUrl></Task>" +
                      "</Module>" +
                      "<Module>" +
                        "<ModuleName>系统配置</ModuleName>" +
                        "<ModuleIcon>Computer.png</ModuleIcon>" +
                          "<Task><TaskGuid>200301</TaskGuid><TaskName>假日管理</TaskName><TaskIcon>Holiday.png</TaskIcon><TaskUrl>/Pages/SysMatain/SysOrg/Department.htm</TaskUrl></Task>" +
                      "</Module>" +
                    "</Document>"
              };

        function createModuleMenu(menuId) {
            var moduleMenu = $("#moduleMenu");
            var len = moduleMenu.accordion("panels").length;
            var panelTitle;
            if (len > 0) {
                for (i = 0; i < len; i++) {
                    panelTitle = moduleMenu.accordion("panels")[len - i - 1].panel("options").title;
                    //alert($panelTitle + ":" + $moduleMenu.accordion("panels")[len - i - 1].panel("options").content);
                    moduleMenu.accordion("remove", panelTitle);
                }
            }

            //var taskText = platform.getData(Session.LoginUser().UserGuid, SysConstant.TaskGuid.OrgInfo, appGuid, Constant.SysDataType.OrgInfo.AppTaskList);
            var taskText = moduleMenuList[menuId];
            try {
                var taskXml = utility.xml.convertXmlStringToDoc(taskText);
                var moduleList = taskXml.find("Module");
                $.each(moduleList, function (i, n) {
                    var moduleName = $(n).find("ModuleName").text();
                    var moduleIcon = $(n).find("ModuleIcon").text();
                    if (moduleIcon.length == 0) moduleIcon = undefined;
                    //moduleMenu.accordion("add", { title: moduleName });
                    //var taskMenu = moduleMenu.accordion("getPanel", moduleName);

                    var menulist = '<ul>';
                    var taskList = $(n).find("Task");
                    $.each(taskList, function (i, n) {
                        var taskName = $(n).find("TaskName").text();
                        var taskGuid = $(n).find("TaskGuid").text();
                        var taskUrl = $(n).find("TaskUrl").text();
                        var taskIcon = $(n).find("TaskIcon").text();
                        //$("<p class=\"taskMenuItem\" onclick=\"selectTask('" + taskGuid + "','" + taskName + "','" + taskUrl + "');\">" + taskName + "</p>").linkbutton({}).appendTo(taskMenu);
                        //$.each(n.menus, function (j, o) {
                        menulist += "<li><div id='" + taskGuid + "' onclick=\"selectMenu('" + taskGuid + "','" + taskName + "','" + taskUrl + "','" + taskIcon + "');\">" +
                            (taskIcon.length > 0 ? "<img width=16 height=16 border=0 src='/Images/icons/" + taskIcon + "' style='top: 4px; position: relative;' />&nbsp" : "") +
                            "<span class=\"nav\">" + taskName + "</span></a></div></li>";
                    });
                    menulist += '</ul>';
                    moduleMenu.accordion("add", {
                        title: moduleName,
                        content: menulist,
                        iconCls: moduleIcon
                    });
                });
                if (moduleList.length > 0) {
                    panelTitle = moduleMenu.accordion("panels")[0].panel("options").title;
                    $("#moduleMenu").accordion("select", panelTitle);
//                    var pp = moduleMenu.accordion("getSelected");
//                    pp.panel("header").triggerHandler("click");
                }
            }
            catch (e) {
                utility.message.sysError(e);
            }
        }

        function selectMenu(taskGuid, taskName, taskUrl, taskIcon) {
            $('.easyui-accordion li div').removeClass("selected");
            $("#" + taskGuid).addClass("selected");
            selectTask(taskGuid, taskName, taskUrl, taskIcon);
        }

    </script>
    <div id="moduleMenu" class="easyui-accordion" fit="true"> 

    </div>
</body>
</html>
